package com.linyubing.dao;

import com.linyubing.pojo.BasePojo;

import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

//泛型dao接口：定义crud的模板方法
//T，这个类型参数必须是 BasePojo 或其子类的实例
public interface BaseDao<T extends BasePojo> {
    //添加实体
    boolean add(T entity) throws SQLException, InvocationTargetException, IllegalAccessException;
    //根据id修改实体
    boolean update(T entity) throws SQLException, InvocationTargetException, IllegalAccessException;
    //根据id删除实体
    boolean deleteById(Integer id) throws SQLException;
    //根据id查询实体
    T getById(Integer id) throws SQLException, InvocationTargetException, InstantiationException, IllegalAccessException;
    //查询所有
    List<T> getAll() throws SQLException, InvocationTargetException, InstantiationException, IllegalAccessException;
    //根据实体多条件查询
    List<T> getByCondition(T Entity) throws InvocationTargetException, IllegalAccessException, SQLException, InstantiationException;

}
